package com.example.springboot1.controller;

import com.example.springboot1.bean.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
@RequestMapping("/users")
@RestController
public class UsersController {
    @GetMapping("/response1")
    public String response1(){
        User user = User.builder()
                .id(1)
                .name("张三")
                .adder("郑州")
                .build();
        return user.toString();
    }
    @GetMapping("/response2")
    public String response2(){
        List<User> list = new ArrayList<>();
        User User1 = User.builder().id(1).name("张三").adder("郑州").build();
        User User2 = User.builder().id(2).name("李四").adder("郑州").build();
        list.add(User1);
        list.add(User2);
        return list.toString();
    }
}
